home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / sysdeps / standalone / i386 / force_cpu386 / strtsupp.S < prev    next >
Encoding:
Text File  |  1994-08-25  |  2.9 KB  |  90 lines

  1. /* Copyright (C) 1994 Free Software Foundation, Inc.
  2.    Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
  3.      On-Line Applications Research Corporation.
  4.  
  5. This file is part of the GNU C Library.
  6.  
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Library General Public License as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version.
  11.  
  12. The GNU C Library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. Library General Public License for more details.
  16.  
  17. You should have received a copy of the GNU Library General Public
  18. License along with the GNU C Library; see the file COPYING.LIB.  If
  19. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  20. Cambridge, MA 02139, USA.  */
  21.  
  22. /*  This file assists the board independent startup code by
  23.  *  loading the proper segment register values.  The values
  24.  *  loaded are dependent on the FORCEBUG.  
  25.  *
  26.  *  NOTE:  No stack has been established when this routine
  27.  *         is invoked.  It returns by jumping back to the start code.
  28.  *
  29.  */
  30.  
  31. /*
  32.  *  FORCEBUG loads us into a virtual address space which 
  33.  *  really starts at PHYSICAL_ADDRESS_BASE.  
  34.  *  
  35.  */
  36.  
  37. .set PHYSICAL_ADDRESS_BASE,    0x00002000
  38.  
  39. /*
  40.  *  At reset time, FORCEBUG normally has the segment selectors preloaded.   
  41.  *  If a human resets the instruction pointer, this will not have occurred.
  42.  *  However, no guarantee can be made of the other registers if cs:ip was 
  43.  *  modified to restart the program.  Because of this, the BSP reloads all 
  44.  *  segment registers (except cs) with the values they have following 
  45.  *  a reset.  
  46.  */
  47.  
  48.  
  49. .set RESET_SS, 0x40        # initial value of stack segment register
  50. .set RESET_DS, 0x40        # initial value of data segment register
  51. .set RESET_ES, 0x40        # initial value of extra segment register
  52. .set RESET_FS, 0x40        # initial value of "f" segment register
  53. .set RESET_GS, 0x30        # initial value of "g" segment register 
  54.  
  55.  
  56. #define LOAD_SEGMENTS(_value,_segreg) \
  57.         movw      $_value##,%ax ;  \
  58.         movw      %ax,##_segreg
  59.  
  60.     
  61.         .global  _load_segments
  62.  
  63.         .global   _establish_stack
  64.  
  65. _load_segments:
  66.  
  67.         LOAD_SEGMENTS( RESET_SS, %ss )
  68.         LOAD_SEGMENTS( RESET_DS, %ds )
  69.         LOAD_SEGMENTS( RESET_ES, %es )
  70.         LOAD_SEGMENTS( RESET_FS, %fs )
  71.         LOAD_SEGMENTS( RESET_GS, %gs )
  72.  
  73.         jmp     _establish_stack        # return to the bsp entry code
  74.  
  75.         .global  _return_to_monitor
  76. _return_to_monitor:
  77.  
  78.         movb    $0,%al
  79.         int     $0x20                   # restart FORCEbug
  80.         jmp     start                   # FORCEbug does not reset PC
  81.  
  82.         .data
  83.  
  84.         .global _Do_Load_IDT
  85. _Do_Load_IDT:   .byte 1
  86.  
  87.         .global _Do_Load_GDT
  88. _Do_Load_GDT:   .byte 0
  89.  
  90.